package com.mt.roll.common.controller;


import com.mt.roll.common.service.DataDictionaryService;
import com.mt.roll.common.vo.DataDictionaryVo;
import com.mt.roll.common.vo.SysDictDataVo;
import com.mt.roll.core.base.BaseController;
import com.mt.roll.core.constants.CommonConstant;
import com.mt.roll.core.dal.entity.*;
import com.mt.roll.core.dal.service.*;
import com.mt.roll.core.utils.BeanUtils;
import com.mt.roll.core.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: liguanghao
 * @Date: 2021/1/20 14:05
 * @Version 1.0
 */
@RestController
@RequestMapping(CommonConstant.API_MODULE_COMMON + "data-dictionary")
@Slf4j
@Api(value = "数据字典", tags = "数据字典", hidden = false)
public class DataDictionaryController extends BaseController {
    @Autowired
    private DataDictionaryService dataDictionaryService;
    @Autowired
    private FactoryServiceBiz factoryServiceBiz;
    @Autowired
    private SysDictDataServiceBiz sysDictDataServiceBiz;
    @Autowired
    private SysOrgServiceBiz sysOrgServiceBiz;



    @PostMapping(value = "equipmentTypeList")
    @ApiOperation(value = "获取设备类型列表")
    private R<List<DataDictionaryVo>> equipmentTypeList() {
        return dataDictionaryService.equipmentTypeList();
    }

    @PostMapping(value = "equipmentList")
    @ApiOperation(value = "获取设备列表")
    private R<List<DataDictionaryVo>> equipmentList() {
        return dataDictionaryService.equipmentList();
    }

/*    @PostMapping(value = "sparePartList")
    @ApiOperation(value = "获取备品备件列表")
    private R<List<DataDictionaryVo>> sparePartList() {
        List<ToolSparePart> list = toolSparePartServiceBiz.list();
        List<DataDictionaryVo> dataDictionaryVos = BeanUtils.copyList(list, DataDictionaryVo.class);
        return successful(dataDictionaryVos);
    }*/

    //@Author:wxt
    //@Date: 2021/1/25 9:05
    @PostMapping(value = "factoryList")
    @ApiOperation(value = "获取工厂列表")
    private R<List<DataDictionaryVo>> factoryList() {
        List<Factory> list = factoryServiceBiz.list();
        List<DataDictionaryVo> dataDictionaryVos = BeanUtils.copyList(list, DataDictionaryVo.class);
        return successful(dataDictionaryVos);
    }

/*    @PostMapping(value = "productionLineList")
    @ApiOperation(value = "获取产线列表")
    private R<List<DataDictionaryVo>> productionLineList() {
        List<ProductionLine> list = productionLineServiceBiz.list();
        List<DataDictionaryVo> dataDictionaryVos = BeanUtils.copyList(list, DataDictionaryVo.class);
        return successful(dataDictionaryVos);
    }*/

/*    @PostMapping(value = "majorList")
    @ApiOperation(value = "获取专业列表")
    private R<List<DataDictionaryVo>> majorList() {
        List<Major> list = majorServiceBiz.list();
        List<DataDictionaryVo> dataDictionaryVos = BeanUtils.copyList(list, DataDictionaryVo.class);
        return successful(dataDictionaryVos);
    }*/

    @PostMapping(value = "sysDictDataList")
    @ApiOperation(value = "获取单位列表")
    private R<List<SysDictDataVo>> sysDictDataList() {
        List<SysDictData> list = sysDictDataServiceBiz.list();
        List<SysDictDataVo> dataDictionaryVos = BeanUtils.copyList(list, SysDictDataVo.class);
        return successful(dataDictionaryVos);
    }
    @PostMapping(value = "orgList")
    @ApiOperation(value = "获取组织列表")
    private R<List<SysDictDataVo>> orgDictdataList(){
        List<SysOrg> list = sysOrgServiceBiz.list();
        List<SysDictDataVo> dataDictionaryVos = BeanUtils.copyList(list, SysDictDataVo.class);
        return successful(dataDictionaryVos);
    }
}
